package com.example.dddsample.application.assembler.mapper;

import com.example.dddsample.application.api.response.CustomerResponseDTO;
import com.example.dddsample.domain.entity.CustomerAggregate;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author: bebm
 * @date: 2022/3/29 15:00
 * @description:
 */
@Mapper
public interface CustomerMapper {

    CustomerMapper INST=Mappers.getMapper(CustomerMapper.class);



    @Mappings({
           /* @Mapping(target="custId",source="source.custId"),
            @Mapping(target="custName",source="source.custName"),
            @Mapping(target="province",expression="java(source.getAddressVO().getProvince())"),
            @Mapping(target="city",expression="java(source.getAddressVO().getCity())"),
            @Mapping(target="address",expression="java(source.getAddressVO().getAddressDetail())")*/
    })
     CustomerResponseDTO fromCustomerAggregate(CustomerAggregate source);

    @Mappings({})
    List<CustomerResponseDTO> fromCustomerAggregateList(List<CustomerAggregate> source);
}
